<%-- 
    Document   : manageCategory
    Created on : Jun 5, 2012, 2:19:29 PM
    Author     : Owner
--%>

<%@include file="/jsp/adminTop.jsp" %>

<html>
    <head>
        <title>Category Maintenance</title>      
    </head>
    <body>
        <div class="clear"></div>
        <table cellspacing="5px" width="100%" align="center">
            <tr>
                <td>
                    <table cellspacing="5px" width="100%" align="center">
                        <tr>
                            <td style="vertical-align: top;" width="20%">
                                <%@include file="/jsp/right.jsp" %>
                            </td>
                            <td style="vertical-align: top;" width="80%">
                                <div class="page-title"><h1>Manage Categories</h1></div>
                                <table align="center" border="1" cellspacing="5px" width="100%" >
                                    <tr>
                                        <td width="20%" style="vertical-align: bottom;">
                                            <a href="./category.do?action=showAddCategory"><span>Add New Category</span></a>
                                        </td>
                                        <td width="80%">
                                            <html:form action="/category" method="post">
                                                <table border="1" align="center" cellspacing="5" width="100%">
                                                    <tr>
                                                        <td align="right">
                                                            Select Category:
                                                            <html:select property="parentCategoryId">
                                                                <html:option value="0">All Category</html:option>
                                                                <html:options collection="categoryMap" property="key" labelProperty="value"/>
                                                            </html:select>
                                                        </td>
                                                        <td style="vertical-align: bottom;">
                                                            <a onclick="javascript:searchCategory('./category.do?action=searchCategory','CategoryBean')">
                                                                <img alt="Find" src="images/find.png" onmouseover="src='images/find-hover.png'" onmouseout="src='images/find.png'" />
                                                            </a>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </html:form>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <table border="1" cellspacing="10px" id="results" align="center" width="100%">
                                                <colgroup>
                                                    <col width="5%">
                                                    <col width="30%">
                                                    <col width="25%">
                                                    <col width="15%">
                                                    <col width="20%">
                                                    <col width="5%">
                                                </colgroup>
                                                <tr>
                                                    <td><strong>ID</strong></td>
                                                    <td><strong>Category</strong></td>
                                                    <td><strong>Parent Category</strong></td>
                                                    <td><strong>Status</strong></td>
                                                    <td><strong>Edit / Test</strong></td>
                                                    <td><strong>Delete</strong></td>
                                                </tr>
                                                <logic:notPresent name="categoryList" scope="request">
                                                    <tr>
                                                        <td colspan="6"> No records Found </td>
                                                    </tr>
                                                </logic:notPresent>
                                                <logic:present name = "categoryList" scope="request">
                                                    <logic:iterate id="categories" name="categoryList" scope="request">
                                                        <tr>
                                                            <td><bean:write name="categories" property="categoryId"/></td>
                                                            <td><bean:write name="categories" property="categoryName"/></td>
                                                            <td><bean:write name="categories" property="parentCategory"/></td>
                                                            <td><bean:write name="categories" property="categoryStatus"/></td>
                                                            <td>[<a href="./category.do?action=showEditCategory&categoryId=<bean:write name="categories" property="categoryId"/>" >Edit</a> | <a href="#"> Test</a>]</td>
                                                            <td><a href="./category.do?action=deleteCategory&categoryId=<bean:write name="categories" property="categoryId"/>" >Delete</a></td>
                                                        </tr>
                                                    </logic:iterate>
                                                </logic:present>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                <div id="pageNavPosition" align="center"></div>

                                <script type="text/javascript"><!--
                                    var pager = new Pager('results', 10);
                                    pager.init();
                                    pager.showPageNav('pager', 'pageNavPosition');
                                    pager.showPage(1);
                                    //--></script>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td><%@include file="/jsp/footer.jsp" %></td>
            </tr>
        </table>


    </body>
</html>
